from appium_practice.PO_MODE.page.basepage import CommonBasePage


# 通讯录页面
class AddressPage(CommonBasePage):

    def goto_main_page(self):
        from appium_practice.PO_MODE.page.mainpage import MainPage
        return MainPage(self.appium_driver)

    def add_members(self):
        """
        添加成员按钮
        :return:
        """
        self.swipe_down(3)
        self.find_app_element_and_click(('XPATH', "//android.widget.ListView/android.widget.RelativeLayout[last()]"))
        from appium_practice.PO_MODE.page.addmemberspage import AddMembersPage
        return AddMembersPage(self.appium_driver)

    def find_members(self):
        """
        查找按钮
        :return:
        """
        self.find_app_element_and_click(('xpath', "//android.widget.TextView[contains(@text,'测试企业')]"
                                                  "/ancestor::android.widget.LinearLayout[3]"
                                                  "/following-sibling::android.widget.LinearLayout[1]/"
                                                  "android.widget.RelativeLayout[1]/android.widget.TextView[1]"))
        from appium_practice.PO_MODE.page.findmemberspage import FindMembersPage
        return FindMembersPage(self.appium_driver)
